package com.originskyseed.platform.task.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.originskyseed.platform.core.base.BasePage;
import com.originskyseed.platform.task.model.Task;
import com.originskyseed.platform.task.model.TaskRankVO;
import com.originskyseed.platform.task.model.TaskRelateAssignPerson;
import com.originskyseed.platform.task.model.TaskVO;
import com.originskyseed.platform.user.model.Dept;
import com.originskyseed.platform.user.model.UserInfo;

/**
 * 任务表Service接口类（OSI_TASK）
 *
 * @author wlj
 */
public interface ITaskService {

	/**
	 * 删除记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKey(String id) throws Exception;

	/**
	 * 批量删除记录
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int deleteByPrimaryKeys(List<String> ids) throws Exception;

	/**
	 * 批量删除记录
	 *
	 * @param ids
	 * @return
	 * @throws Exception
	 */
	public int updateByKeys(List<String> ids) throws Exception;

	/**
	 * 插入记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insert(Task record) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int insertSelective(Task record) throws Exception;

	/**
	 * 插入记录（仅非空值字段）
	 *
	 * @param recordVO
	 * @return
	 * @throws Exception
	 */
	public int insertSelectiveByTaskVO(TaskVO recordVO) throws Exception;

	/**
	 * 批量插入
	 *
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public int insertBatch(List<TaskRelateAssignPerson> list) throws Exception;

	/**
	 * 任务发布
	 *
	 * @param recordVO
	 * @return
	 * @throws Exception
	 */
	public int insertSelectiveByTaskVOAndUserInfo(TaskVO recordVO, UserInfo userInfo) throws Exception;

	/**
	 * 更新记录
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKey(Task record) throws Exception;

	/**
	 * 更新记录
	 *
	 * @param recordVO
	 * @return
	 * @throws Exception
	 */
	public int updateByTaskVO(TaskVO recordVO) throws Exception;

	/**
	 * 定时更新状态（定时任务）
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int updateTaskStateByKey(String id) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKeySelective(Task record) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public int updateByPrimaryKeySelectiveTenantCode(Task record, String tenantCode) throws Exception;

	/**
	 * 上下架
	 *
	 * @param task
	 * @return
	 * @throws Exception
	 */
	public int updateByTaskId(Task task) throws Exception;

	/**
	 * 更新记录（仅非空值字段）
	 *
	 * @param recordVO
	 * @return
	 * @throws Exception
	 */
	public int updateByTaskVOSelective(TaskVO recordVO, UserInfo userInfo) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Task selectByPrimaryKey(String id) throws Exception;

	/**
	 * 查询记录（租户模式）
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Task selectByPrimaryKeyTenantCode(String id, String tenantCode) throws Exception;

	/**
	 * 查询记录
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public TaskVO selectByTaskVOPrimaryKey(String id, String userId) throws Exception;

	/**
	 * 查询列表
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectList(Task record) throws Exception;

	/**
	 * 查询列表_租户模式（定时任务）
	 *
	 * @param record
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectList(Task record, String tenantCode) throws Exception;

	/**
	 * 接单中心_分页查询列表
	 *
	 * @param params
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public BasePage<Task> selectListByPage(Map<String, Object> params, BasePage<Task> page, UserInfo userInfo) throws Exception;

	/**
	 * 我的任务列表_分页查询
	 *
	 * @param params
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public BasePage<Task> selectCenterListByPage(Map<String, Object> params, BasePage<Task> page, UserInfo userInfo) throws Exception;

	/**
	 * 开放平台任务列表_分页查询
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public BasePage<Task> selectAdminListByPage(Map<String, Object> params, BasePage<Task> page, UserInfo userInfo) throws Exception;

	/**
	 * 任务列表_导出
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectTaskExport(Map<String, Object> params, UserInfo userInfo) throws Exception;

	/**
	 * 查询任务详情
	 *
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Task selectByTaskid(String id) throws Exception;

	/**
	 * 查询我的任务总数
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public int selectTodayTaskCount(Map<String, Object> map) throws Exception;

	/**
	 * 查询工会的今日任务
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public int tradeTodayTaskCount(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据查询
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> getTaskLineChar(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_周统计
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> getTaskLineWeekAndMonth(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_日数据_完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskFinishState(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_日数据_未完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskUnFinishState(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_日数据_逾期状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskOverState(Map<String, Object> map) throws Exception;

	/**
	 * 任务小时维度统计
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public Map<String, Object> getTaskHourStat(Map<String, Object> map) throws Exception;

	/**
	 * 业务员/主播任务小时维度统计
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public Map<String, Object> getTaskHourStatByAnchorAndSaleMan(Map<String, Object> map, UserInfo userInfo) throws Exception;

	/**
	 * 任务周维度统计
	 *
	 * @param weekmap
	 * @return
	 * @throws Exception
	 */
	public Map<String, Object> getTaskWeekStat(Map<String, Object> weekmap, Date date) throws Exception;

	/**
	 * 主播/业务员 按任务周维度统计
	 *
	 * @param weekmap
	 * @return
	 * @throws Exception
	 */
	public Map<String, Object> getTaskWeekStatToSaleManOrAnchor(Map<String, Object> weekmap, UserInfo userInfo) throws Exception;

	/**
	 * 图形数据_周_月统计_完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskFinishStateWeekAndMonth(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_周_月统计_未完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskUnFinishStateWeekAndMonth(Map<String, Object> map) throws Exception;

	/**
	 * 图形数据_周_月统计_逾期状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskOverStateWeekAndMonth(Map<String, Object> map) throws Exception;

	/**
	 * 任务月维度统计
	 *
	 * @param monthmap
	 * @return
	 * @throws Exception
	 */
	public Map<String, Object> getTaskMonthStat(Map<String, Object> monthmap, Date startdate, Date enddate) throws Exception;

	/**
	 * 业务员/主播 统计任务月维度统计
	 *
	 * @param monthmap
	 * @return
	 * @throws Exception
	 */
	public Map<String, Object> getTaskMonthStatToSaleManOrAnchor(Map<String, Object> monthmap, Date startdate, Date enddate, UserInfo userInfo) throws Exception;

	/**
	 * 业务员/主播任务完成情况图形数据_日统计_完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskByDeptFinishState(Map<String, Object> map) throws Exception;

	/**
	 * 业务员/主播任务完成情况图形数据_日统计_逾期状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskByDeptOverState(Map<String, Object> map) throws Exception;

	/**
	 * 排行榜
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public List<TaskRankVO> selectRankList(Map<String, Object> params) throws Exception;

	/**
	 * 我的排名
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	// public int myRank(Map<String, Object> params) throws Exception;

	/**
	 * 我的排名
	 *
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public TaskRankVO selectmyRankList(Map<String, Object> params) throws Exception;

	/**
	 * 运管统计看板数据
	 *
	 * @return
	 * @throws Exception
	 */
	public int owTotalData(Map<String, Object> params) throws Exception;

	/**
	 * 工会业务员完成率统计
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Integer>> getTaskLineToSaler(Map<String, Object> map) throws Exception;

	/**
	 * 开放平台工会任务看板数据
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> tradeUnionDataLine(Map<String, Object> map, Dept dept) throws Exception;

	/**
	 * 开放平台工会任务情况数据
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public int countTradeUnionTaskByState(Map<String, Object> map) throws Exception;

	/**
	 * 业务员/主播任务完成情况图形数据_周月统计_完成状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskByDeptFinishStateWeekOrMonth(Map<String, Object> map) throws Exception;

	/**
	 * 业务员/主播任务完成情况图形数据_周月统计_逾期状态
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<Map<String, Object>> countTaskByDeptOverStateWeekOrMonth(Map<String, Object> map) throws Exception;

	/**
	 * 开放平台统计家族/工会体系任务
	 *
	 * @param type
	 * @param dept
	 * @return
	 * @throws Exception
	 */
	public Map<String, Object> countSystemBytypeAndDept(int type, Dept dept) throws Exception;

	/**
	 * 统计 我的 家族 工会 今日任务
	 *
	 * @return
	 * @throws Exception
	 */
	public Map<String, Integer> countMyTaskNum(int type, UserInfo userInfo) throws Exception;

	/**
	 * 查询我/工会/家族的发布任务数量
	 *
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public int tradePublishTaskCount(Map<String, Object> map) throws Exception;

	/**
	 * 新员工添加培训任务
	 *
	 * @param type
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectNewUserTrainTaskJobList(int type, String tenantCode) throws Exception;

	/**
	 * 新员工添加培训任务
	 *
	 * @param type
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectNewUserTrainTaskList(int type) throws Exception;

	/**
	 * 查询推广任务
	 *
	 * @param state
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectPromoteTaskJobList(int state) throws Exception;

	/**
	 * 查询推广任务
	 *
	 * @param state
	 * @return
	 * @throws Exception
	 */
	public List<Task> selectPromoteTaskJobListTenantCode(int state, String tenantCode) throws Exception;


	/**
	 * 新增维护任务
	 * @param tenantCode
	 * @return
	 * @throws Exception
	 */
	public int insertMaintainTask(String tenantCode) throws Exception;

}
